package com.albaba.designpattern.factory.text_002.service.impl;

import com.albaba.designpattern.factory.text_001.entity.AwardInfo;
import com.albaba.designpattern.factory.text_001.entity.SmallGiftInfo;
import com.albaba.designpattern.factory.text_002.entity.ResponseResult;
import com.albaba.designpattern.factory.text_002.service.IFreeGoods;

import java.util.UUID;

/**
 * @Description: 小礼品
 * @Author zx
 * @Date 2025/2/19 10:44
 * @Version 1.0
 */
public class SmallGiftFreeGoodServiceImpl implements IFreeGoods {

    @Override
    public ResponseResult sendFreeGoods(AwardInfo awardInfo) {

        SmallGiftInfo smallGiftInfo = new SmallGiftInfo();
        smallGiftInfo.setUserName(awardInfo.getExtMap().get("userName"));
        smallGiftInfo.setAddress(awardInfo.getExtMap().get("address"));
        smallGiftInfo.setOrderId(UUID.randomUUID().toString());
        smallGiftInfo.setUserPhone(awardInfo.getExtMap().get("phone"));
        System.out.println("小礼品已经发送，获奖用户注意查收！" + smallGiftInfo.toString());

        return new ResponseResult("0000", "发放小礼品成功", awardInfo);
    }
}
